import CryptoJS from 'crypto-js';
const SECRET_KEY = import.meta.env.VITE_CRYPTO_KEY; // 从环境变量获取

export const encrypt = (data) => {
  return CryptoJS.AES.encrypt(data, SECRET_KEY).toString();
};

export const decrypt = (cipherText) => {
  const bytes = CryptoJS.AES.decrypt(cipherText, SECRET_KEY);
  return bytes.toString(CryptoJS.enc.Utf8);
};